﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyBlog.ServiceInterface;
using MyBlog.Model;
using MyBlog.Common;
using MyBlog.BusinessInterface;


namespace MyBlog.Service
{
    public class ArticleService : IArticleService
    {
        IBusinessArticle _business;

        public ArticleService(IBusinessArticle business)
        {
            _business = business;
        }

        public void Add(ArticleModel entity)
        {
            _business.Add(entity);
        }

        public void AddRange(IEnumerable<ArticleModel> entities)
        {
            _business.AddRange(entities);
        }

        public void Update(ArticleModel entity)
        {
            _business.Update(entity);
        }

        public void AddReadOrAgreeCount(int id, ArticleDo opera)
        {
            _business.AddReadOrAgreeCount(id, opera);
        }

        public void Delete(params object[] primaryKey)
        {
            _business.Delete(primaryKey);
        }

        public void Delete(ArticleModel model)
        {
            _business.Delete(model);
        }

        public void DeleteRange(IEnumerable<ArticleModel> entities)
        {
            _business.DeleteRange(entities);
        }

        public ArticleModel Get(params object[] primaryKey)
        {
            return _business.Get(primaryKey);
        }

        public ArticleModel Get(ArticleModel model)
        {
            return _business.Get(model);
        }

        public List<ArticleModel> GetAll(bool isTracking = true)
        {
            return _business.GetAll(isTracking);
        }

        public List<ArticleModel> GetAll(ArticleModel model, bool isTracking = true)
        {
            return _business.GetAll(model, isTracking);
        }

        public List<ArticleModel> GetAll(ArticleModel model, int page, int size, out int total, bool isTracking = true)
        {
            throw new NotImplementedException();
        }

        public void AddAgree(int id, string account)
        {
            _business.AddAgree(id, account);
        }

        public List<Tuple<int, string>> GetArticlePrevAndNext(int aid)
        {
            return _business.GetArticlePrevAndNext(aid);
        }
    }
}
